import React, { PureComponent } from 'react'
import { HashRouter, Route, Link, Switch } from 'react-router-dom'
import Main from './main'
import About from './about'
import Topic from './topic'
export default class Home extends PureComponent{
    
    render() {
        return (
            // 加载任何页面之前，必须先把路由加载进来，这样才会实现路由的跳转
            <HashRouter>
                <div>
                    <ul>
                        <li>
                            <Link to='/'>Home</Link>
                        </li>
                        <li>
                            <Link to='/about'>About</Link>
                        </li>
                        <li>
                            <Link to='/topic'>Topic</Link>
                        </li>
                    </ul>
                    <hr/>
                    <Switch>
                        <Route exact={true} path='/' component={Main}></Route>
                        <Route path='/about' component={About}></Route>
                        <Route path='/topic' component={Topic}></Route>
                    </Switch>
                    </div>
            </HashRouter>
        )
    }
}